package cn.waxcc.controller;

import cn.waxcc.pojo.Commodity;
import cn.waxcc.pojo.ResponseResult;
import cn.waxcc.service.CommodityService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


@RestController
@RequiredArgsConstructor
@RequestMapping("/commodity")
public class CommodityController {

    private final CommodityService commodityService;


    @GetMapping("")
    public ResponseResult getCommodity(){
        return commodityService.getCommodityService();
    }

    @PostMapping("")
    public ResponseResult addCommodity(@RequestBody Commodity commodity){
        return commodityService.addCommodityService(commodity);
    }

    @PutMapping("")
    public ResponseResult putCommodity(@RequestBody Commodity commodity){
        return commodityService.putCommodityService(commodity);
    }
    @DeleteMapping("")
    public ResponseResult deleteCommodity(){
        return commodityService.deleteCommodityService();
    }
}
